<!DOCTYPE html>
<html lang="en-US">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>Android 界面编程 | 江流</title>
    <meta name="generator" content="VuePress 1.8.2">
    <link rel="icon" href="/favicon.ico">
    <script>
	  var _hmt = _hmt || [];
	  (function() {
	    var hm = document.createElement("script");
		hm.src = "https://hm.baidu.com/hm.js?d53065bd59576478808301d9b305d57a";
	    var s = document.getElementsByTagName("script")[0]; 
	    s.parentNode.insertBefore(hm, s);
	  })();
	  </script>        
	  </script>
    <meta name="description" content="我的知识存储空间，不大不小刚刚好！">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no">
    
    <link rel="preload" href="/assets/css/0.styles.f7444686.css" as="style"><link rel="preload" href="/assets/js/app.371ed010.js" as="script"><link rel="preload" href="/assets/js/3.fe7e7b6d.js" as="script"><link rel="preload" href="/assets/js/1.adb5634c.js" as="script"><link rel="preload" href="/assets/js/33.52d0ee09.js" as="script"><link rel="prefetch" href="/assets/js/10.1f1951c3.js"><link rel="prefetch" href="/assets/js/100.61abc83e.js"><link rel="prefetch" href="/assets/js/101.36b1a9cd.js"><link rel="prefetch" href="/assets/js/102.ab6aaef1.js"><link rel="prefetch" href="/assets/js/103.56b65027.js"><link rel="prefetch" href="/assets/js/104.10a9920d.js"><link rel="prefetch" href="/assets/js/105.2af1fce1.js"><link rel="prefetch" href="/assets/js/106.89d909fa.js"><link rel="prefetch" href="/assets/js/107.8a051ba9.js"><link rel="prefetch" href="/assets/js/108.8d32e2bb.js"><link rel="prefetch" href="/assets/js/109.98a9c733.js"><link rel="prefetch" href="/assets/js/11.4f1a38c2.js"><link rel="prefetch" href="/assets/js/110.cb2819bf.js"><link rel="prefetch" href="/assets/js/111.3763e438.js"><link rel="prefetch" href="/assets/js/112.437502fc.js"><link rel="prefetch" href="/assets/js/113.c84b80e9.js"><link rel="prefetch" href="/assets/js/114.e8265ab7.js"><link rel="prefetch" href="/assets/js/115.5950f39b.js"><link rel="prefetch" href="/assets/js/116.7082589d.js"><link rel="prefetch" href="/assets/js/117.9ab33002.js"><link rel="prefetch" href="/assets/js/118.b03051ef.js"><link rel="prefetch" href="/assets/js/119.31fe4216.js"><link rel="prefetch" href="/assets/js/12.397d3f87.js"><link rel="prefetch" href="/assets/js/120.4d52fd08.js"><link rel="prefetch" href="/assets/js/121.024a68dc.js"><link rel="prefetch" href="/assets/js/122.75cd9e9a.js"><link rel="prefetch" href="/assets/js/123.3060f162.js"><link rel="prefetch" href="/assets/js/124.b65e3f9b.js"><link rel="prefetch" href="/assets/js/125.87d06856.js"><link rel="prefetch" href="/assets/js/126.23d0d6ec.js"><link rel="prefetch" href="/assets/js/127.1ff7063e.js"><link rel="prefetch" href="/assets/js/128.e7a78683.js"><link rel="prefetch" href="/assets/js/129.3a378a54.js"><link rel="prefetch" href="/assets/js/13.d1346059.js"><link rel="prefetch" href="/assets/js/130.3820ccc0.js"><link rel="prefetch" href="/assets/js/14.961feb61.js"><link rel="prefetch" href="/assets/js/15.61355499.js"><link rel="prefetch" href="/assets/js/16.6759c278.js"><link rel="prefetch" href="/assets/js/17.39315298.js"><link rel="prefetch" href="/assets/js/18.9995ddc3.js"><link rel="prefetch" href="/assets/js/19.e7007f1f.js"><link rel="prefetch" href="/assets/js/20.8284a0ff.js"><link rel="prefetch" href="/assets/js/21.42efcf40.js"><link rel="prefetch" href="/assets/js/22.ce83188a.js"><link rel="prefetch" href="/assets/js/23.125b374b.js"><link rel="prefetch" href="/assets/js/24.9a24b2f6.js"><link rel="prefetch" href="/assets/js/25.61d7e926.js"><link rel="prefetch" href="/assets/js/26.4c271fce.js"><link rel="prefetch" href="/assets/js/27.08314644.js"><link rel="prefetch" href="/assets/js/28.44a30857.js"><link rel="prefetch" href="/assets/js/29.4b86327a.js"><link rel="prefetch" href="/assets/js/30.284e1438.js"><link rel="prefetch" href="/assets/js/31.c7fb218e.js"><link rel="prefetch" href="/assets/js/32.9591edea.js"><link rel="prefetch" href="/assets/js/34.24dce9bc.js"><link rel="prefetch" href="/assets/js/35.e9e59a19.js"><link rel="prefetch" href="/assets/js/36.470d3b70.js"><link rel="prefetch" href="/assets/js/37.f43d4d57.js"><link rel="prefetch" href="/assets/js/38.bb14e7a9.js"><link rel="prefetch" href="/assets/js/39.4238fcd3.js"><link rel="prefetch" href="/assets/js/4.10111819.js"><link rel="prefetch" href="/assets/js/40.eb5830d8.js"><link rel="prefetch" href="/assets/js/41.f2de0dd7.js"><link rel="prefetch" href="/assets/js/42.ee6bc670.js"><link rel="prefetch" href="/assets/js/43.aeb80fc2.js"><link rel="prefetch" href="/assets/js/44.3dcf73d7.js"><link rel="prefetch" href="/assets/js/45.f60dd2b7.js"><link rel="prefetch" href="/assets/js/46.3ffd9a49.js"><link rel="prefetch" href="/assets/js/47.0629cfd8.js"><link rel="prefetch" href="/assets/js/48.4064d363.js"><link rel="prefetch" href="/assets/js/49.e5cd2868.js"><link rel="prefetch" href="/assets/js/5.bbaa5544.js"><link rel="prefetch" href="/assets/js/50.e1524d44.js"><link rel="prefetch" href="/assets/js/51.ef5d60b4.js"><link rel="prefetch" href="/assets/js/52.9e15bbc1.js"><link rel="prefetch" href="/assets/js/53.9e53a9b3.js"><link rel="prefetch" href="/assets/js/54.bda58726.js"><link rel="prefetch" href="/assets/js/55.cdc29215.js"><link rel="prefetch" href="/assets/js/56.3f0607d3.js"><link rel="prefetch" href="/assets/js/57.b45ba0fb.js"><link rel="prefetch" href="/assets/js/58.12450427.js"><link rel="prefetch" href="/assets/js/59.33096dcc.js"><link rel="prefetch" href="/assets/js/6.8df5fb44.js"><link rel="prefetch" href="/assets/js/60.98645e3a.js"><link rel="prefetch" href="/assets/js/61.413d9151.js"><link rel="prefetch" href="/assets/js/62.cc3b9f5a.js"><link rel="prefetch" href="/assets/js/63.05784f29.js"><link rel="prefetch" href="/assets/js/64.d6d2548e.js"><link rel="prefetch" href="/assets/js/65.dfa3ba68.js"><link rel="prefetch" href="/assets/js/66.bb4f5fde.js"><link rel="prefetch" href="/assets/js/67.2c282a4f.js"><link rel="prefetch" href="/assets/js/68.ce435a87.js"><link rel="prefetch" href="/assets/js/69.e439f6e2.js"><link rel="prefetch" href="/assets/js/7.751d2655.js"><link rel="prefetch" href="/assets/js/70.270cc6b6.js"><link rel="prefetch" href="/assets/js/71.ad1e4a0b.js"><link rel="prefetch" href="/assets/js/72.0adf2b53.js"><link rel="prefetch" href="/assets/js/73.72e019b5.js"><link rel="prefetch" href="/assets/js/74.a4eb5a17.js"><link rel="prefetch" href="/assets/js/75.6412ff6f.js"><link rel="prefetch" href="/assets/js/76.7f462fc1.js"><link rel="prefetch" href="/assets/js/77.16502231.js"><link rel="prefetch" href="/assets/js/78.3082b00c.js"><link rel="prefetch" href="/assets/js/79.4f375500.js"><link rel="prefetch" href="/assets/js/8.6c3fab20.js"><link rel="prefetch" href="/assets/js/80.0f2472d6.js"><link rel="prefetch" href="/assets/js/81.136b6c89.js"><link rel="prefetch" href="/assets/js/82.6f5b7de7.js"><link rel="prefetch" href="/assets/js/83.0eb8579b.js"><link rel="prefetch" href="/assets/js/84.b50a036d.js"><link rel="prefetch" href="/assets/js/85.e7b43c1a.js"><link rel="prefetch" href="/assets/js/86.0cbd7e7b.js"><link rel="prefetch" href="/assets/js/87.647fd8a9.js"><link rel="prefetch" href="/assets/js/88.be268039.js"><link rel="prefetch" href="/assets/js/89.2c0b397f.js"><link rel="prefetch" href="/assets/js/9.ace3bd0d.js"><link rel="prefetch" href="/assets/js/90.fb93a187.js"><link rel="prefetch" href="/assets/js/91.45160178.js"><link rel="prefetch" href="/assets/js/92.4e47d015.js"><link rel="prefetch" href="/assets/js/93.2f9bae72.js"><link rel="prefetch" href="/assets/js/94.c68d9319.js"><link rel="prefetch" href="/assets/js/95.a6932cad.js"><link rel="prefetch" href="/assets/js/96.dea31892.js"><link rel="prefetch" href="/assets/js/97.e8c73484.js"><link rel="prefetch" href="/assets/js/98.bf38dbf7.js"><link rel="prefetch" href="/assets/js/99.edd450af.js">
    <link rel="stylesheet" href="/assets/css/0.styles.f7444686.css">
  </head>
  <body>
    <div id="app" data-server-rendered="true"><div class="theme-container" data-v-6f8f7dda><div data-v-6f8f7dda><div class="password-shadow password-wrapper-out" style="display:none;" data-v-f68096de data-v-6f8f7dda data-v-6f8f7dda><h3 class="title" data-v-f68096de>江流</h3> <p class="description" data-v-f68096de>我的知识存储空间，不大不小刚刚好！</p> <label id="box" class="inputBox" data-v-f68096de><input type="password" value="" data-v-f68096de> <span data-v-f68096de>Konck! Knock!</span> <button data-v-f68096de>OK</button></label> <div class="footer" data-v-f68096de><span data-v-f68096de><i class="iconfont reco-theme" data-v-f68096de></i> <a target="blank" href="https://vuepress-theme-reco.recoluan.com" data-v-f68096de>vuePress-theme-reco</a></span> <span data-v-f68096de><i class="iconfont reco-copyright" data-v-f68096de></i> <a data-v-f68096de><span data-v-f68096de>江流</span>
          
        <span data-v-f68096de>2018 - </span>
        2023
      </a></span></div></div> <div class="hide" data-v-6f8f7dda><header class="navbar" data-v-6f8f7dda><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/" class="home-link router-link-active"><img src="/logo.png" alt="江流" class="logo"> <span class="site-name">江流</span></a> <div class="links"><div class="color-picker"><a class="color-button"><i class="iconfont reco-color"></i></a> <div class="color-picker-menu" style="display:none;"><div class="mode-options"><h4 class="title">Choose mode</h4> <ul class="color-mode-options"><li class="dark">dark</li><li class="auto active">auto</li><li class="light">light</li></ul></div></div></div> <div class="search-box"><i class="iconfont reco-search"></i> <input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/" class="nav-link"><i class="iconfont reco-home"></i>
  首页
</a></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-category"></i>
      分类
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/categories/复盘/" class="nav-link"><i class="undefined"></i>
  复盘
</a></li><li class="dropdown-item"><!----> <a href="/categories/学习总结/" class="nav-link"><i class="undefined"></i>
  学习总结
</a></li><li class="dropdown-item"><!----> <a href="/categories/踩坑/" class="nav-link"><i class="undefined"></i>
  踩坑
</a></li><li class="dropdown-item"><!----> <a href="/categories/工具/" class="nav-link"><i class="undefined"></i>
  工具
</a></li><li class="dropdown-item"><!----> <a href="/categories/Linux/" class="nav-link"><i class="undefined"></i>
  Linux
</a></li><li class="dropdown-item"><!----> <a href="/categories/算法/" class="nav-link"><i class="undefined"></i>
  算法
</a></li><li class="dropdown-item"><!----> <a href="/categories/Java基础/" class="nav-link"><i class="undefined"></i>
  Java基础
</a></li><li class="dropdown-item"><!----> <a href="/categories/高并发编程/" class="nav-link"><i class="undefined"></i>
  高并发编程
</a></li><li class="dropdown-item"><!----> <a href="/categories/数据库/" class="nav-link"><i class="undefined"></i>
  数据库
</a></li><li class="dropdown-item"><!----> <a href="/categories/Java框架/" class="nav-link"><i class="undefined"></i>
  Java框架
</a></li><li class="dropdown-item"><!----> <a href="/categories/学习笔记/" class="nav-link"><i class="undefined"></i>
  学习笔记
</a></li><li class="dropdown-item"><!----> <a href="/categories/框架学习/" class="nav-link"><i class="undefined"></i>
  框架学习
</a></li><li class="dropdown-item"><!----> <a href="/categories/Java项目/" class="nav-link"><i class="undefined"></i>
  Java项目
</a></li></ul></div></div><div class="nav-item"><a href="/tag/" class="nav-link"><i class="iconfont reco-tag"></i>
  标签
</a></div><div class="nav-item"><a href="/timeline/" class="nav-link"><i class="iconfont reco-date"></i>
  时间轴
</a></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-note"></i>
      学习笔记
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/docs/major-notes/java/" class="nav-link"><i class="undefined"></i>
  Java笔记整理
</a></li><li class="dropdown-item"><!----> <a href="/docs/major-notes/juc/" class="nav-link"><i class="undefined"></i>
  JUC学习笔记
</a></li><li class="dropdown-item"><!----> <a href="/docs/more-notes/jvm.html" class="nav-link"><i class="undefined"></i>
  JVM核心知识
</a></li><li class="dropdown-item"><!----> <a href="/docs/more-notes/vue.html" class="nav-link"><i class="undefined"></i>
  Vue入门笔记
</a></li><li class="dropdown-item"><!----> <a href="/docs/major-notes/linux/" class="nav-link"><i class="undefined"></i>
  Linux笔记整理
</a></li><li class="dropdown-item"><!----> <a href="/docs/major-notes/redis/" class="nav-link"><i class="undefined"></i>
  Redis学习笔记
</a></li><li class="dropdown-item"><!----> <a href="/docs/major-notes/springcloud/" class="nav-link"><i class="undefined"></i>
  SpringCloud笔记
</a></li><li class="dropdown-item"><!----> <a href="/docs/major-notes/spring/" class="nav-link"><i class="undefined"></i>
  Spring学习笔记
</a></li><li class="dropdown-item"><!----> <a href="/docs/more-notes/shiro.html" class="nav-link"><i class="undefined"></i>
  Shiro学习笔记
</a></li><li class="dropdown-item"><!----> <a href="/docs/android-notes/" class="nav-link router-link-active"><i class="undefined"></i>
  Android学习笔记
</a></li><li class="dropdown-item"><!----> <a href="/docs/project-notes/" class="nav-link"><i class="undefined"></i>
  项目笔记
</a></li></ul></div></div><div class="nav-item"><a href="/docs/collections/" class="nav-link"><i class="iconfont reco-collection"></i>
  收藏夹
</a></div><div class="nav-item"><a href="/docs/life-logs/" class="nav-link"><i class="iconfont reco-camera"></i>
  生活日志
</a></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-browse"></i>
      常用网站
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="http://www.cxysite.com/" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="undefined"></i>
  程序员导航
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li><li class="dropdown-item"><!----> <a href="https://www.nowcoder.com/" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="undefined"></i>
  牛客网
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li><li class="dropdown-item"><!----> <a href="https://leetcode-cn.com/" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="undefined"></i>
  力扣
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-person"></i>
      私藏博客
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="https://docker.easydoc.net" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="undefined"></i>
  快速入门docker
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li><li class="dropdown-item"><!----> <a href="https://www.nowcoder.com/" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="undefined"></i>
  牛客网
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li><li class="dropdown-item"><!----> <a href="https://leetcode-cn.com/" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="undefined"></i>
  力扣
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-message"></i>
      联系方式
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="https://gitee.com/" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont reco-gitee"></i>
  Gitee
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li><li class="dropdown-item"><!----> <a href="https://github.com/" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont reco-github"></i>
  GitHub
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul></div></div> <!----></nav></div></header> <div class="sidebar-mask" data-v-6f8f7dda></div> <aside class="sidebar" data-v-6f8f7dda><div class="personal-info-wrapper" data-v-cc06b9e8 data-v-6f8f7dda><img src="/avatar.png" alt="author-avatar" class="personal-img" data-v-cc06b9e8> <h3 class="name" data-v-cc06b9e8>
    江流
  </h3> <div class="num" data-v-cc06b9e8><div data-v-cc06b9e8><h3 data-v-cc06b9e8>104</h3> <h6 data-v-cc06b9e8>Articles</h6></div> <div data-v-cc06b9e8><h3 data-v-cc06b9e8>21</h3> <h6 data-v-cc06b9e8>Tags</h6></div></div> <ul class="social-links" data-v-cc06b9e8></ul> <hr data-v-cc06b9e8></div> <nav class="nav-links"><div class="nav-item"><a href="/" class="nav-link"><i class="iconfont reco-home"></i>
  首页
</a></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-category"></i>
      分类
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/categories/复盘/" class="nav-link"><i class="undefined"></i>
  复盘
</a></li><li class="dropdown-item"><!----> <a href="/categories/学习总结/" class="nav-link"><i class="undefined"></i>
  学习总结
</a></li><li class="dropdown-item"><!----> <a href="/categories/踩坑/" class="nav-link"><i class="undefined"></i>
  踩坑
</a></li><li class="dropdown-item"><!----> <a href="/categories/工具/" class="nav-link"><i class="undefined"></i>
  工具
</a></li><li class="dropdown-item"><!----> <a href="/categories/Linux/" class="nav-link"><i class="undefined"></i>
  Linux
</a></li><li class="dropdown-item"><!----> <a href="/categories/算法/" class="nav-link"><i class="undefined"></i>
  算法
</a></li><li class="dropdown-item"><!----> <a href="/categories/Java基础/" class="nav-link"><i class="undefined"></i>
  Java基础
</a></li><li class="dropdown-item"><!----> <a href="/categories/高并发编程/" class="nav-link"><i class="undefined"></i>
  高并发编程
</a></li><li class="dropdown-item"><!----> <a href="/categories/数据库/" class="nav-link"><i class="undefined"></i>
  数据库
</a></li><li class="dropdown-item"><!----> <a href="/categories/Java框架/" class="nav-link"><i class="undefined"></i>
  Java框架
</a></li><li class="dropdown-item"><!----> <a href="/categories/学习笔记/" class="nav-link"><i class="undefined"></i>
  学习笔记
</a></li><li class="dropdown-item"><!----> <a href="/categories/框架学习/" class="nav-link"><i class="undefined"></i>
  框架学习
</a></li><li class="dropdown-item"><!----> <a href="/categories/Java项目/" class="nav-link"><i class="undefined"></i>
  Java项目
</a></li></ul></div></div><div class="nav-item"><a href="/tag/" class="nav-link"><i class="iconfont reco-tag"></i>
  标签
</a></div><div class="nav-item"><a href="/timeline/" class="nav-link"><i class="iconfont reco-date"></i>
  时间轴
</a></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-note"></i>
      学习笔记
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/docs/major-notes/java/" class="nav-link"><i class="undefined"></i>
  Java笔记整理
</a></li><li class="dropdown-item"><!----> <a href="/docs/major-notes/juc/" class="nav-link"><i class="undefined"></i>
  JUC学习笔记
</a></li><li class="dropdown-item"><!----> <a href="/docs/more-notes/jvm.html" class="nav-link"><i class="undefined"></i>
  JVM核心知识
</a></li><li class="dropdown-item"><!----> <a href="/docs/more-notes/vue.html" class="nav-link"><i class="undefined"></i>
  Vue入门笔记
</a></li><li class="dropdown-item"><!----> <a href="/docs/major-notes/linux/" class="nav-link"><i class="undefined"></i>
  Linux笔记整理
</a></li><li class="dropdown-item"><!----> <a href="/docs/major-notes/redis/" class="nav-link"><i class="undefined"></i>
  Redis学习笔记
</a></li><li class="dropdown-item"><!----> <a href="/docs/major-notes/springcloud/" class="nav-link"><i class="undefined"></i>
  SpringCloud笔记
</a></li><li class="dropdown-item"><!----> <a href="/docs/major-notes/spring/" class="nav-link"><i class="undefined"></i>
  Spring学习笔记
</a></li><li class="dropdown-item"><!----> <a href="/docs/more-notes/shiro.html" class="nav-link"><i class="undefined"></i>
  Shiro学习笔记
</a></li><li class="dropdown-item"><!----> <a href="/docs/android-notes/" class="nav-link router-link-active"><i class="undefined"></i>
  Android学习笔记
</a></li><li class="dropdown-item"><!----> <a href="/docs/project-notes/" class="nav-link"><i class="undefined"></i>
  项目笔记
</a></li></ul></div></div><div class="nav-item"><a href="/docs/collections/" class="nav-link"><i class="iconfont reco-collection"></i>
  收藏夹
</a></div><div class="nav-item"><a href="/docs/life-logs/" class="nav-link"><i class="iconfont reco-camera"></i>
  生活日志
</a></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-browse"></i>
      常用网站
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="http://www.cxysite.com/" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="undefined"></i>
  程序员导航
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li><li class="dropdown-item"><!----> <a href="https://www.nowcoder.com/" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="undefined"></i>
  牛客网
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li><li class="dropdown-item"><!----> <a href="https://leetcode-cn.com/" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="undefined"></i>
  力扣
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-person"></i>
      私藏博客
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="https://docker.easydoc.net" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="undefined"></i>
  快速入门docker
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li><li class="dropdown-item"><!----> <a href="https://www.nowcoder.com/" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="undefined"></i>
  牛客网
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li><li class="dropdown-item"><!----> <a href="https://leetcode-cn.com/" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="undefined"></i>
  力扣
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-message"></i>
      联系方式
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="https://gitee.com/" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont reco-gitee"></i>
  Gitee
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li><li class="dropdown-item"><!----> <a href="https://github.com/" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont reco-github"></i>
  GitHub
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul></div></div> <!----></nav> <ul class="sidebar-links"><li><a href="/docs/android-notes/01-android-.html" class="sidebar-link">Android入门</a></li><li><a href="/docs/android-notes/02-four-contents.html" class="sidebar-link">Android四大组件</a></li><li><a href="/docs/android-notes/03-android-ui.html" aria-current="page" class="active sidebar-link">Android 界面编程</a></li><li><a href="/docs/android-notes/04-fragment-.html" class="sidebar-link">Fragment</a></li><li><a href="/docs/android-notes/05-file-io.html" class="sidebar-link">Android数据存储与IO</a></li><li><a href="/docs/android-notes/06-jni.html" class="sidebar-link">JNI学习笔记</a></li><li><a href="/docs/android-notes/07-aidl.html" class="sidebar-link">AIDL学习笔记</a></li><li><a href="/docs/android-notes/08-evnt-handler.html" class="sidebar-link">Android事件机制</a></li><li><a href="/docs/android-notes/09-signature-mechanism.html" class="sidebar-link">Android 签名机制详解</a></li></ul> </aside> <div class="password-shadow password-wrapper-in" style="display:none;" data-v-f68096de data-v-6f8f7dda><h3 class="title" data-v-f68096de></h3> <!----> <label id="box" class="inputBox" data-v-f68096de><input type="password" value="" data-v-f68096de> <span data-v-f68096de>Konck! Knock!</span> <button data-v-f68096de>OK</button></label> <div class="footer" data-v-f68096de><span data-v-f68096de><i class="iconfont reco-theme" data-v-f68096de></i> <a target="blank" href="https://vuepress-theme-reco.recoluan.com" data-v-f68096de>vuePress-theme-reco</a></span> <span data-v-f68096de><i class="iconfont reco-copyright" data-v-f68096de></i> <a data-v-f68096de><span data-v-f68096de>江流</span>
          
        <span data-v-f68096de>2018 - </span>
        2023
      </a></span></div></div> <div data-v-6f8f7dda><div data-v-6f8f7dda><main class="page"><section style="display:;"><div class="page-title"><h1 class="title">Android 界面编程</h1> <div data-v-1e62957f><i class="iconfont reco-account" data-v-1e62957f><span data-v-1e62957f>江流</span></i> <!----> <!----> <!----></div></div> <div class="theme-reco-content content__default"><h1 id="android-界面编程"><a href="#android-界面编程" class="header-anchor">#</a> Android 界面编程</h1> <h2 id="布局管理器"><a href="#布局管理器" class="header-anchor">#</a> 布局管理器</h2> <p>布局管理器继承了<code>View</code>，可以作为普通<code>UI</code>使用。包括<code>LinearLayout</code>|<code>TableLayout</code>、<code>FrameLayout</code>、<code>ConstrainLayout</code>、<code>AbsoluteLayout</code>、<code>Relativelayout</code>、<code>GridLayout</code> ，其中<code>AbsoluteLayout</code>很难兼容不同屏幕大小和分辨率问题，已经过时；<code>Relativelayout</code>、<code>GridLayout</code> 在<code>Android9.0</code>标注为不推荐使用，推荐使用<code>ConstrainLayout</code>替代。</p> <h3 id="linearlayout"><a href="#linearlayout" class="header-anchor">#</a> LinearLayout</h3> <table><thead><tr><th>xml属性</th> <th>相关方法</th> <th>说明</th></tr></thead> <tbody><tr><td>android:gravity</td> <td>setGravity(int)</td> <td>设置布局内组件的对齐方式，包括top、bottom、left、right、center_vertical、center_horizontal、fill_horizoontal、fill、center、clip_vertical、clip_horizontal，同时支持组合方式，如left|center_vertical</td></tr> <tr><td>android:orientation</td> <td>setOrientation(int)</td> <td>设置布局内组件的排列方式，包括horizontal（水平）、vertical（垂直）</td></tr> <tr><td>android:layout_gravity</td> <td></td> <td>指定该子元素在LinearLayout中的对其方式</td></tr> <tr><td>android:layout_weight</td> <td></td> <td>指定该子元素在LinearLayout中所占的权重</td></tr></tbody></table> <h3 id="tablelayout"><a href="#tablelayout" class="header-anchor">#</a> TableLayout</h3> <table><thead><tr><th>xml属性</th> <th>相关方法</th> <th>说明</th></tr></thead> <tbody><tr><td>android:collapseColumns</td> <td>setColumnCollapsed(int,boolean)</td> <td>设置需要被隐藏列的序列号，多个序列号之间使用逗号分隔</td></tr> <tr><td>android:shrinkColumns</td> <td>setShrinAllColumns(boolean)</td> <td>设置允许被收缩的列的列序号，多个列序号之间使用逗号分隔</td></tr> <tr><td>android:stretchColumns</td> <td>setStretchAllColumns(boolean)</td> <td>设置允许被拉伸的列的列序号，多个列序号之间用逗号分隔</td></tr></tbody></table> <h3 id="framelayout"><a href="#framelayout" class="header-anchor">#</a> FrameLayout</h3> <table><thead><tr><th>xml属性</th> <th>相关方法</th> <th>说明</th></tr></thead> <tbody><tr><td>android:foregroundGravity</td> <td>setForegroundGravity(int)</td> <td>定义绘制前景图像的gravity属性</td></tr> <tr><td>android:measureAllChildren</td> <td>setMeasureAllChildren(boolean)</td> <td>设置该布局计算大小时是否考虑所有子组件</td></tr></tbody></table> <h3 id="constrainlayout"><a href="#constrainlayout" class="header-anchor">#</a> ConstrainLayout</h3> <table><thead><tr><th>xml属性</th> <th>说明</th></tr></thead> <tbody><tr><td>android:layout_constraintXxx_toXxxOf</td> <td>设置组件与父容器对齐，包括<code>Start</code>、<code>End</code>、<code>Top</code>、<code>Button</code>等值，也可以是<code>parent</code>和其他组件<code>id</code></td></tr> <tr><td>android:layout_marginXxx</td> <td>设置该组件与参照组件中的间距，包括<code>Top</code>、<code>Bottom</code>等值</td></tr> <tr><td>android:layout_constraintXxx_bias</td> <td>设置该组件在参照组件中的百分比，可以是<code>Horizontal</code>和<code>Vertical</code></td></tr></tbody></table> <h2 id="textview及其子类"><a href="#textview及其子类" class="header-anchor">#</a> TextView及其子类</h2> <h3 id="textview"><a href="#textview" class="header-anchor">#</a> TextView</h3> <table><thead><tr><th>xml属性</th> <th>相关方法</th> <th>说明</th></tr></thead> <tbody><tr><td>android:autoText</td> <td>setKeyListener(keyListener)</td> <td>控制是否将<code>URL</code>、<code>E-mail</code>地址等链接自动转换为可单击的链接</td></tr> <tr><td>android:capitalize</td> <td>setKeyListener(keyListener)</td> <td>控制是否将用户输入文本转换为大小写字母</td></tr> <tr><td>android:editable</td> <td></td> <td>设置该文本是否允许编辑</td></tr> <tr><td>android:gravity</td> <td>setGravity(int)</td> <td>设置文本框内文本的对齐方式</td></tr> <tr><td>android:hint</td> <td>setHint(int)</td> <td>设置该文本框的默认提示内容</td></tr> <tr><td>android:intputType</td> <td>setRawInputType(int)</td> <td>指定该文本框类型</td></tr> <tr><td>android:maxLength</td> <td>setFilters(InputFilter)</td> <td>设置该文本框的最大字符</td></tr> <tr><td>android:passwd</td> <td>setTransformationMethod(TransformationMethod)</td> <td>设置该文本框为密码输入框</td></tr> <tr><td>android:phoneNumber</td> <td>setKeyListener(KeyListener)</td> <td>设置该文本框只能输入电话号码</td></tr> <tr><td>android:singleLine</td> <td>setTransformationMethod(TransformationMethod)</td> <td>设置该文本框为单行模式</td></tr> <tr><td>android:text</td> <td>setText(CharSequence)</td> <td>设置文本框内的内容</td></tr></tbody></table> <h3 id="edittext"><a href="#edittext" class="header-anchor">#</a> EditText</h3> <p><code>EditText</code>与<code>TextView</code>公用绝大部分<code>XML</code>属性和方法，区别在于<code>EditText</code>与<code>TextView</code>最大的区别在于：<code>EditText</code>可以接收用户输入。</p> <p><code>EditText</code>组件还派生出了两个子类：</p> <ol><li><code>AutoCompleteTextView</code>：带有自动完成功能的<code>EditText</code></li> <li><code>ExtraEditText</code>：不是<code>UI</code>组件而是<code>EditText</code>的底层服务类，负责提供全屏输入法支持。</li></ol> <h3 id="button"><a href="#button" class="header-anchor">#</a> Button</h3> <table><thead><tr><th>xml属性</th> <th>方法</th> <th>说明</th></tr></thead> <tbody><tr><td>android:onclick</td> <td>setClickListener(OnClickListener)</td> <td>添加onclick事件</td></tr> <tr><td>android:background</td> <td>setBackground(Drawable)</td> <td>设置按钮背景</td></tr></tbody></table> <h3 id="radiobutton和checkbox"><a href="#radiobutton和checkbox" class="header-anchor">#</a> RadioButton和CheckBox</h3> <p><code>RadioButton</code>、<code>CheckBox</code>、<code>ToggleButton</code>、<code>Switch</code>都继承了<code>Button</code>，因此都可以使用<code>Button</code>支持的属性和方法。<code>RadioButton</code>和<code>CheckBox</code>都可额外指定一个<code>android:checked</code>属性，用于指定组件是否被选中。不同之处在于，一组<code>RadioButton</code>只能选中其中一个，因此<code>RadioButton</code>通常需要与<code>RadioGroup</code>一起使用，用于定义一组单选按钮。</p> <h3 id="togglebutton和switch"><a href="#togglebutton和switch" class="header-anchor">#</a> ToggleButton和Switch</h3> <p><strong>ToggleButton</strong></p> <table><thead><tr><th>xml属性</th> <th>说明</th></tr></thead> <tbody><tr><td>android:disabledAlpha</td> <td>设置禁用指示器的透明度</td></tr> <tr><td>android:textOff</td> <td>设置该按钮关闭状态的显示文本</td></tr> <tr><td>android:textOn</td> <td>设置该按钮打开状态的显示文本</td></tr></tbody></table> <p><strong>Switch</strong></p> <table><thead><tr><th>xml属性</th> <th>说明</th></tr></thead> <tbody><tr><td>android:layout_showText(boolean)</td> <td>设置是否绘制开关文本</td></tr> <tr><td>android:layout_setSwitchMinWidth(int)</td> <td>设置该组件与参照组件中的间距，包括<code>Top</code>、<code>Button</code>等值</td></tr> <tr><td>android:textOff</td> <td>设置该按钮关闭状态的显示文本</td></tr> <tr><td>android:textOn</td> <td>设置该按钮打开状态的显示文本</td></tr></tbody></table> <h3 id="analogclock和textclock"><a href="#analogclock和textclock" class="header-anchor">#</a> AnalogClock和TextClock</h3> <p><code>TextClock</code>继承了<code>TextView</code>，与<code>TextView</code>不同的是，为<code>TextClock</code>设置<code>android:text</code>属性没有什么作用。<code>TextClock</code>显示数字时钟，可显示当前秒数，<code>AnalogClock</code>显示模拟时钟，不会显示当前秒数。</p> <p><strong>TextClock</strong></p> <table><thead><tr><th>xml属性</th> <th>相关方法</th> <th>说明</th></tr></thead> <tbody><tr><td>android:format12Hour</td> <td>setFormat12Hour(CharSequence)</td> <td>设置禁用指示器的透明度</td></tr> <tr><td>android:textOff</td> <td>setFormat12Hour(CharSequence)</td> <td>设置该按钮关闭状态的显示文本</td></tr> <tr><td>android:textOn</td> <td>setTimeZone(String)</td> <td>设置该按钮打开状态的显示文本</td></tr></tbody></table> <p><strong>AnalogClock</strong></p> <table><thead><tr><th>xml属性</th> <th>说明</th></tr></thead> <tbody><tr><td>android:dial</td> <td>设置该模拟时钟表盘使用的图片</td></tr> <tr><td>android:hand_hour</td> <td>设置该按模拟时钟时针使用的图片</td></tr> <tr><td>android:hand_time</td> <td>设置该模拟时钟分针使用的图片</td></tr></tbody></table> <h3 id="chronometer"><a href="#chronometer" class="header-anchor">#</a> Chronometer</h3> <table><thead><tr><th>xml属性</th> <th>说明</th></tr></thead> <tbody><tr><td>android:format</td> <td>设置该计时器的事件显示格式</td></tr> <tr><td>android:countDown</td> <td>设置该计时器是否从开始重新计时</td></tr></tbody></table> <table><thead><tr><th>常用方法</th> <th>说明</th></tr></thead> <tbody><tr><td>setBase</td> <td>设置计时器的起始时间</td></tr> <tr><td>setFormate</td> <td>设置计时器的事件显示格式</td></tr> <tr><td>start()</td> <td>启动计时器开始计时</td></tr> <tr><td>stop()</td> <td>关闭计时器停止计时</td></tr> <tr><td>setOnChronometer(Chronometer.OnChronometerTickListener listener)</td> <td>为计时器绑定监听事件，当计时器改变时触发该监听器</td></tr></tbody></table> <h2 id="imageview及其子类"><a href="#imageview及其子类" class="header-anchor">#</a> ImageView及其子类</h2> <h3 id="imageview"><a href="#imageview" class="header-anchor">#</a> ImageView</h3> <table><thead><tr><th>xml属性</th> <th>相关方法</th> <th>说明</th></tr></thead> <tbody><tr><td>android:adjustViewBound</td> <td>setAdjustViewBound(boolean)</td> <td>设置<code>ImageView</code>是否调整自己的边界来保持所显示的图片长宽比</td></tr> <tr><td>android:baseline</td> <td>setBaseline(int)</td> <td>设置基线在该组件内的偏移量</td></tr> <tr><td>android:baselineAlignBotton</td> <td>setBaselineAlignBotton(boolean)</td> <td>如果属性值为<code>true</code>，组件会根据其底边基线对其</td></tr> <tr><td>android:cropTopPadding</td> <td>setCropTopadding(boolean)</td> <td>如果属性值为<code>true</code>，组件将会被裁剪到保留该<code>ImageView</code>的<code>padding</code></td></tr> <tr><td>android:maxHeight</td> <td>setMaxHeight(int)</td> <td>设置<code>ImageView</code>的最大高度</td></tr> <tr><td>android:maxWidth</td> <td>setMaxWidth(int)</td> <td>设置<code>ImageView</code>的最大宽度</td></tr> <tr><td>android:scaleType</td> <td>setScaleType(ImageView.ScaleType)</td> <td>设置图片的缩放方式</td></tr> <tr><td>android:src</td> <td>setImageResource(int)</td> <td>设置<code>ImageView</code>所显示的<code>Drawable</code>对象的<code>ID</code></td></tr> <tr><td>android:tint</td> <td>setImageTintList(ColorStateList)</td> <td>设置对该组件显示的图片重新着色</td></tr> <tr><td>android:tintMode</td> <td>setImageTintMode(ProterDuffer.Mode)</td> <td>设置对该组件显示的图片着色模式</td></tr></tbody></table> <p>为了控制 <code>ImageView</code>显示的图片，<code>ImageView</code>提供了以下方法：</p> <div class="language-java line-numbers-mode"><pre class="language-java"><code><span class="token comment">//使用Bitmap位图设置该ImageView显示的图片</span>
<span class="token function">setImageBitmap</span><span class="token punctuation">(</span><span class="token class-name">Bitmap</span> bm<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">//使用Drawable对象设置该ImageView显示的图片</span>
<span class="token function">setImageDrawable</span><span class="token punctuation">(</span><span class="token class-name">Drawable</span> drawable<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">//使用资源图片ID设置该ImageView显示的图片</span>
<span class="token function">setImageResource</span><span class="token punctuation">(</span><span class="token keyword">int</span> resId<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">//使用图片URL设置该ImageView显示的图片</span>
<span class="token function">setImageURI</span><span class="token punctuation">(</span><span class="token class-name">Uri</span> uri<span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br></div></div><h3 id="floatingactionbutton"><a href="#floatingactionbutton" class="header-anchor">#</a> FloatingActionButton</h3> <h3 id="imageview-2"><a href="#imageview-2" class="header-anchor">#</a> ImageView</h3> <table><thead><tr><th>xml属性</th> <th>说明</th></tr></thead> <tbody><tr><td>app:fabSize</td> <td>指定按钮大小，支持<code>normal</code>，<code>mini</code>两个属性值</td></tr> <tr><td>app:backgroundTint</td> <td>设置按钮的填充色。若不指定该属性，则支持默认填充色</td></tr> <tr><td>app:rippleColor</td> <td>指定悬浮按钮被点击时的波纹颜色</td></tr></tbody></table> <blockquote><p>tips：<code>FlatingActionButton</code>位于<code>support</code>库中，必须先添加后才能使用。在<code>build.gradle</code>文件中添加：<code>implementation 'com.android.support:design:28.0.0'</code></p></blockquote> <h2 id="adapterview及其子类"><a href="#adapterview及其子类" class="header-anchor">#</a> AdapterView及其子类</h2> <p>AdapterView 具有以下特征：</p> <ol><li><code>AdapterView</code> 继承了 <code>ViewGroup</code>，其本质是容器；</li> <li><code>AdapterView</code>可以包括多个&quot;列表项&quot;，并将多个&quot;列表项&quot;以合适的形式显示出来；</li> <li><code>AdapterView</code>显示的多个&quot;列表项&quot;由<code>Adapter</code>提供，通过<code>setAdapterView(Adapter)</code>方法设置<code>Adapter</code>即可。</li></ol> <h3 id="adapter接口及其实现类"><a href="#adapter接口及其实现类" class="header-anchor">#</a> Adapter接口及其实现类</h3> <p><code>Adapter</code>常用实现类如下：</p> <p>ArrayAdapter：简单易用的 Adapter,通常用于将数组或List集合的多个值包装成多个列表项；</p> <div class="language-java line-numbers-mode"><pre class="language-java"><code><span class="token comment">//定义一个数组</span>
<span class="token class-name">String</span><span class="token punctuation">[</span><span class="token punctuation">]</span> arr1 <span class="token operator">=</span>  <span class="token keyword">new</span> <span class="token class-name">String</span><span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">{</span><span class="token string">&quot;孙悟空&quot;</span><span class="token punctuation">,</span><span class="token string">&quot;猪八戒&quot;</span><span class="token punctuation">,</span><span class="token string">&quot;沙悟净&quot;</span><span class="token punctuation">,</span><span class="token string">&quot;牛魔王&quot;</span><span class="token punctuation">}</span><span class="token punctuation">;</span>
<span class="token comment">//将数组包装为ArrayAdapter</span>
<span class="token class-name">ArrayAdapter</span> adapter1 <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">ArrayAdapter</span><span class="token punctuation">(</span><span class="token class-name">MainActivity</span><span class="token punctuation">.</span><span class="token keyword">this</span><span class="token punctuation">,</span><span class="token class-name">R</span><span class="token punctuation">.</span>layout<span class="token punctuation">.</span>array_item<span class="token punctuation">,</span>arr1<span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br></div></div><p>SimpleAdapter：并不简单，功能强大的 Adapter，可用于将 List 集合的多个对象包装成多个列表项；</p> <div class="language-java line-numbers-mode"><pre class="language-java"><code><span class="token class-name">List</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">Map</span><span class="token punctuation">&lt;</span><span class="token class-name">String</span><span class="token punctuation">,</span><span class="token class-name">Object</span><span class="token punctuation">&gt;</span><span class="token punctuation">&gt;</span></span> listItems <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">ArrayList</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token punctuation">&gt;</span></span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">for</span> <span class="token punctuation">(</span><span class="token keyword">int</span> i <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span> i <span class="token operator">&lt;</span> names<span class="token punctuation">.</span>length<span class="token punctuation">;</span> i<span class="token operator">++</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
            <span class="token class-name">Map</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">String</span><span class="token punctuation">,</span><span class="token class-name">Object</span><span class="token punctuation">&gt;</span></span> listItem <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">HashMap</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token punctuation">&gt;</span></span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            listItem<span class="token punctuation">.</span><span class="token function">put</span><span class="token punctuation">(</span><span class="token string">&quot;header&quot;</span><span class="token punctuation">,</span>imageIds<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            listItem<span class="token punctuation">.</span><span class="token function">put</span><span class="token punctuation">(</span><span class="token string">&quot;personName&quot;</span><span class="token punctuation">,</span>names<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            listItem<span class="token punctuation">.</span><span class="token function">put</span><span class="token punctuation">(</span><span class="token string">&quot;desc&quot;</span><span class="token punctuation">,</span>descs<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            listItems<span class="token punctuation">.</span><span class="token function">add</span><span class="token punctuation">(</span>listItem<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token punctuation">}</span>

        <span class="token comment">//创建一个SimpleAdapter</span>
        <span class="token comment">/**
         * 第四个参数:string[]类型参数,确定获取Map&lt;String,?&gt;对象中哪些key对应的value来生成列表项;
         * 第五个参数:int[]类型参数,决定填充哪些组件
         * */</span>
        <span class="token class-name">SimpleAdapter</span> simpleAdapter <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">SimpleAdapter</span><span class="token punctuation">(</span><span class="token keyword">this</span><span class="token punctuation">,</span>listItems<span class="token punctuation">,</span><span class="token class-name">R</span><span class="token punctuation">.</span>layout<span class="token punctuation">.</span>simple_item<span class="token punctuation">,</span>
                <span class="token keyword">new</span> <span class="token class-name">String</span><span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">{</span><span class="token string">&quot;personName&quot;</span><span class="token punctuation">,</span><span class="token string">&quot;header&quot;</span><span class="token punctuation">,</span><span class="token string">&quot;desc&quot;</span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token keyword">new</span> <span class="token keyword">int</span><span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">{</span><span class="token class-name">R</span><span class="token punctuation">.</span>id<span class="token punctuation">.</span>name<span class="token punctuation">,</span><span class="token class-name">R</span><span class="token punctuation">.</span>id<span class="token punctuation">.</span>header<span class="token punctuation">,</span><span class="token class-name">R</span><span class="token punctuation">.</span>id<span class="token punctuation">.</span>desc<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br></div></div><p>SimpleCursorAdapeter：与 SimpleAdapter 基本相似，只是用于通过 Cursor 包装提供的数据。</p> <p>BaseAdapter：通常用于被扩展，通过 BaseAdapter 可以对各项列表项进行最大限度的定制。</p> <h3 id="autocompletetextview"><a href="#autocompletetextview" class="header-anchor">#</a> AutoCompleteTextView</h3> <p><code>AutoCompleteTextView</code>从<code>EditText</code>派生出来，实际上也是一个文本，但比普通文本框多了一个功能，当输入一定字符时，自动完成文本框会显示一个菜单供用户选择，当用户选择某个菜单后，<code>AutoCompleteTextView</code>会自动填写该文本框。</p> <table><thead><tr><th>xml属性</th> <th>相关方法</th> <th>说明</th></tr></thead> <tbody><tr><td>android:completionHint</td> <td>setCompletionHint(CharSequence)</td> <td>设置下拉菜单中的提示标题</td></tr> <tr><td>android:completionHintView</td> <td></td> <td>设置下拉菜单中的提示标题的视图</td></tr> <tr><td>android:completionThreshold</td> <td>setThreshold(int)</td> <td>设置用户至少输入几个字符才显示提示</td></tr> <tr><td>android:dropDownAnchor</td> <td>setDropDownAnchor(int)</td> <td>设置下拉菜单的定位锚点，默认为<code>TextView</code>本身</td></tr> <tr><td>android:dropDownHeight</td> <td>setDropDownHeigh(int)</td> <td>设置下拉菜单的高度</td></tr> <tr><td>android:dropDownHorizontalOffset</td> <td></td> <td>设置下拉菜单与文本框之间的水平位移，默认与文本框对齐</td></tr> <tr><td>android:dropDownVerticalOffset</td> <td></td> <td>设置下拉菜单与文本框之间的垂直间距，默认紧跟文本框</td></tr> <tr><td>android:dropDownWidth</td> <td>setDropDownWidth(int)</td> <td>设置下拉框的宽度</td></tr> <tr><td>android:popupBackground</td> <td>setDropDownBackgroundResource(int)</td> <td>设置下拉菜单的背景</td></tr></tbody></table> <p><code>AutoCompleteTextView</code>还派生出一个子类：<code>MultiAutoCompleteTextView</code>，其允许输入多个提示项并以分隔符分割，通过<code>setTokenizer()</code>方法来设置分隔符。</p> <h3 id="expandablelistview"><a href="#expandablelistview" class="header-anchor">#</a> ExpandableListView</h3> <p><code>ExpandabaleListView</code>是<code>ListView</code>的子类，其不同在于<code>ExpandableListView</code>所显示的列表项是由<code>ExpandableListAdapter</code>提供。</p> <table><thead><tr><th>xml属性</th> <th>说明</th></tr></thead> <tbody><tr><td>android:childDivider</td> <td>指定各组内各子列表项之间的分隔条</td></tr> <tr><td>android:childIndicator</td> <td>显示在子列表旁的Drawable对象</td></tr> <tr><td>android:childIndicatorXxx</td> <td>设置每个子列表项的Xxx（Start、End、Right、Left）边界符，该属性为任意长度</td></tr> <tr><td>android:indecatorXxx</td> <td>设置每个组列表项的Xxx（Start、End、Right、Left）边界符，该属性为任意长度</td></tr> <tr><td>android:groupIndicator</td> <td>设置每个组列表项旁边的Drawable对象</td></tr></tbody></table> <p>实现<code>ExpandableListAdapter</code>有如下三种常用方式：</p> <ol><li>扩展<code>BaseExpandableListAdapter</code>实现<code>ExpandableListAdapter</code>；</li> <li>使用<code>SimpleExpandableListAdapter</code>将两个<code>List</code>集合包装为<code>ExpandableListAdapter</code>；</li> <li>使用<code>SimpleCursorTreeAdapter</code>将<code>Cursor</code>中的数据包装成<code>SimpleCursorTreeAdapter</code>；</li></ol> <h3 id="adapterviewflipper"><a href="#adapterviewflipper" class="header-anchor">#</a> AdapterViewFlipper</h3> <p><code>AdapterViewFlipper</code>继承了<code>AdapterViewAnimator</code>，它会显示<code>Adapter</code>提供的多个<code>View</code>组件，但每次只能显示一个组件。程序可以通过<code>showPrevious()</code> 和<code>showNext()</code>方法控制该组件的显示上一个组件、下一个组件。<code>AdapterViewFlipper</code>可以在多个<code>View</code>切换过程使用渐隐渐现的动画效果。</p> <p><code>AdapterViewAnimator</code>支持的<code>XML</code>属性：</p> <table><thead><tr><th>xml属性</th> <th>说明</th></tr></thead> <tbody><tr><td>android:animateFirstView</td> <td>设置显示该组件的第一个View时是否使用动画</td></tr> <tr><td>android:inAnimation</td> <td>设置组件显示时的动画</td></tr> <tr><td>android:loopViews</td> <td>设置循环到最后一个组件后是否自动跳转至第一个组件</td></tr> <tr><td>android:outAnimation</td> <td>设置组件隐藏时使用的动画</td></tr></tbody></table> <p><code>AdapterViewFlipper</code>额外支持的<code>XML</code>属性：</p> <table><thead><tr><th>xml属性</th> <th>说明</th></tr></thead> <tbody><tr><td>android:startFlipper</td> <td>设置显示该组件是否自动播放</td></tr> <tr><td>android:setFlipInterval(int)</td> <td>设置自动播放的时间间隔</td></tr></tbody></table> <h3 id="stackview"><a href="#stackview" class="header-anchor">#</a> StackView</h3> <p><code>StackView</code>是<code>AdapterViewAnimator</code>的子类，用于显示<code>Adapter</code>提供的一系列<code>View</code>，<code>StackView</code>将以堆叠方式显示多个列表项。</p> <p>为控制<code>StackView</code>显示的<code>View</code>组件，<code>StackView</code>提供了如下两种控制方式：</p> <ol><li>拖动方式</li> <li>通过调用<code>showNext()</code>、<code>showPreviout()</code>控制显示下一个、上一个组件。</li></ol> <h3 id="recyclerview"><a href="#recyclerview" class="header-anchor">#</a> RecyclerView</h3> <p>开发者在编写<code>BaseExpandableListAdapter</code>的子类时，需要对<code>getChildView()</code>、<code>getGroupView()</code>方法进行优化，否则<code>ListView</code>运行时可能不太流畅，这种优化很大程度上依赖于开发者的技巧。此外，<code>ListView</code>通常不支持水平滚动，因此<code>RecyclerView</code>用于替代<code>ListView</code>。</p> <p>改进后的<code>RcyclerView</code>需要使用<code>RecyclerView.Adapter</code>，改进后的<code>RecyclerView.Adapter</code>只需要实现三个方法：</p> <div class="language-java line-numbers-mode"><pre class="language-java"><code><span class="token comment">//用于创建爱你列表项组件，该方法创建的组件会被自动缓存</span>
<span class="token function">onCreateViewHolder</span><span class="token punctuation">(</span><span class="token class-name">ViewGroup</span> viewGroup<span class="token punctuation">,</span> <span class="token keyword">int</span> position<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">//负责为列表项组件绑定数据，每次组件重新显示时会重新执行该方法</span>
<span class="token function">onBindViewHolder</span><span class="token punctuation">(</span><span class="token class-name">ViewHolder</span> viewHolder<span class="token punctuation">,</span> <span class="token keyword">int</span> position<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">//返回值决定包含多少个列表项</span>
<span class="token function">getItemCount</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br></div></div><p><code>RecyclerView.Adapter</code>大致提供了以下方法来控制对列表项的修改：</p> <div class="language-java line-numbers-mode"><pre class="language-java"><code><span class="token comment">//当position位置数据发生改变时，通知Adapter更新界面</span>
<span class="token function">notifyItemChanged</span><span class="token punctuation">(</span><span class="token keyword">int</span> position<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">//当position位置数据发生改变时，通知Adapter从positionStart开始更新itemCount数量的列表项</span>
<span class="token function">notifyItemRangeChanged</span><span class="token punctuation">(</span><span class="token keyword">int</span> positionStart<span class="token punctuation">,</span><span class="token keyword">int</span> itemCount<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">//当方法指定在position位置执行动作</span>
<span class="token function">notifyItemInserted</span><span class="token punctuation">(</span><span class="token keyword">int</span> positon<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">//当方法指定列表项从fromPosition移动到toPosition</span>
<span class="token function">notifyItemMoved</span><span class="token punctuation">(</span><span class="token keyword">int</span> fromPosition<span class="token punctuation">,</span><span class="token keyword">int</span> toPosition<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">//执行插入多个列表项</span>
<span class="token function">notifyItemRangeInserted</span><span class="token punctuation">(</span><span class="token keyword">int</span> position<span class="token punctuation">,</span><span class="token keyword">int</span> itemCount<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">//执行插入多个列表项</span>
<span class="token function">notifyItemRemoved</span><span class="token punctuation">(</span><span class="token keyword">int</span> position<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">//执行删除多个列表项</span>
<span class="token function">notifyItemRangeRemoved</span><span class="token punctuation">(</span><span class="token keyword">int</span> positionStart<span class="token punctuation">,</span><span class="token keyword">int</span> itemCount<span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br></div></div><h2 id="progressbar及其子类"><a href="#progressbar及其子类" class="header-anchor">#</a> ProgressBar及其子类</h2> <h3 id="progressbar"><a href="#progressbar" class="header-anchor">#</a> ProgressBar</h3> <p><code>Android</code>支持多种风格的进度条，通过<code>style</code>属性为<code>ProgressBar</code>指定风格，该属性支持以下值：</p> <div class="language-xml line-numbers-mode"><pre class="language-xml"><code><span class="token comment">&lt;!--水平进度条--&gt;</span>
@android:style/Widget.ProgressBar.Horizontal;
<span class="token comment">&lt;!--普通环形进度条--&gt;</span>
@android:style/Widget.ProgressBar.Inverse;
<span class="token comment">&lt;!--大环形进度条--&gt;</span>
@android:style/Widget.ProgressBar.Large;
<span class="token comment">&lt;!--大环形进度条--&gt;</span>
@android:style/Widget.ProgressBar.Large.Inverse;
<span class="token comment">&lt;!--小环形进度条--&gt;</span>
@android:style/Widget.ProgressBar.Small;
<span class="token comment">&lt;!--小环形进度条--&gt;</span>
@android:style/Widget.ProgressBar.Small.Inverse;
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br></div></div><table><thead><tr><th>xml属性</th> <th>说明</th></tr></thead> <tbody><tr><td>android:max</td> <td>设置进度条的最大值</td></tr> <tr><td>android:progress</td> <td>设置进度条已完成进度值</td></tr> <tr><td>android:progressDrawable</td> <td>设置进度条的轨道对应的Drawable对象</td></tr> <tr><td>android:indeteminate</td> <td>设置为true，设置进度条不精确显示进度</td></tr> <tr><td>android:indeteminateDrawable</td> <td>设置绘制不显示进度的进度条的Drawable对象</td></tr> <tr><td>android:indeteminateDuration</td> <td>设置不精确显示进度的持续时间</td></tr></tbody></table> <p><code>ProgressBar</code>提供了以下方法来操作进度：</p> <ol><li><code>setProgress(int)</code>：设置进度的完成百分比；</li> <li><code>incrementProgress(int)</code>：设置及进度条的增减。</li></ol> <h3 id="seekbar"><a href="#seekbar" class="header-anchor">#</a> SeekBar</h3> <p>拖动条<code>SeekBar</code>继承了<code>ProgressBar</code>，允许用户改变其外观，改变滑块外观通过以下属性设置：</p> <table><thead><tr><th>xml属性</th> <th>说明</th></tr></thead> <tbody><tr><td>android:thumb</td> <td>指定一个Drawable对象，将其作为自定义滑块</td></tr> <tr><td>android:tickMark</td> <td>指定一个Drawable对象，将其作为自定义刻度图标</td></tr></tbody></table> <p>为了使程序响应拖动条滑块位置改变，可以绑定一个<code>onSeekBarChangeListener</code>监听器。</p> <h3 id="ratingbar"><a href="#ratingbar" class="header-anchor">#</a> RatingBar</h3> <p>星级评分条<code>RatingBar</code>与拖动条<code>SeekBar</code>区别在于<code>RatingBar</code>使用星星来表示进度。</p> <table><thead><tr><th>xml属性</th> <th>说明</th></tr></thead> <tbody><tr><td>android:isindicator</td> <td>设置评分条是否允许用户改变（true为不允许改变）</td></tr> <tr><td>android:numStarts</td> <td>设置评分条总共有多少星级</td></tr> <tr><td>android:ratings</td> <td>设置评分条默认星级</td></tr> <tr><td>android:stepSize</td> <td>设置每次需要改变多少个星级</td></tr></tbody></table> <h2 id="viewanimator及其子类"><a href="#viewanimator及其子类" class="header-anchor">#</a> ViewAnimator及其子类</h2> <p><code>ViewAnimator</code>主要功能是添加动画效果，常用<code>XML</code>属性如下：</p> <table><thead><tr><th>xml属性</th> <th>说明</th></tr></thead> <tbody><tr><td>android:animateFirstView</td> <td>设置<code>ViewAnimator</code>显示第一个<code>View</code>组件时是否使用动画</td></tr> <tr><td>android:numStarts</td> <td>设置<code>ViewAnimator</code>显示组件时所使用的动画</td></tr> <tr><td>android:ratings</td> <td>设置<code>ViewAnimator</code>隐藏组件时所使用的动画</td></tr></tbody></table> <h3 id="viewswitcher"><a href="#viewswitcher" class="header-anchor">#</a> ViewSwitcher</h3> <p><code>ViewSwitcher</code>代表了视图切换组件，继承于<code>FrameLayout</code>，可以将多个<code>View</code>层叠在一起，每次只显示一个组件。使用<code>ViewFactory</code>为其创建<code>View</code>，通过 <code>setFactory(ViewSwitcher.ViewFactory)</code>方法为之设置<code>ViewFactory</code>。</p> <div class="language-java line-numbers-mode"><pre class="language-java"><code>switcher<span class="token punctuation">.</span><span class="token function">setFactory</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">-&gt;</span> <span class="token punctuation">{</span>
    <span class="token comment">// 加载R.layout.slidelistview组件，实际上就是一个GridView组件</span>
    <span class="token keyword">return</span> inflater<span class="token punctuation">.</span><span class="token function">inflate</span><span class="token punctuation">(</span><span class="token class-name">R</span><span class="token punctuation">.</span>layout<span class="token punctuation">.</span>slidelistview<span class="token punctuation">,</span> <span class="token keyword">null</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br></div></div><h3 id="imageswithcer"><a href="#imageswithcer" class="header-anchor">#</a> ImageSwithcer</h3> <p><code>ImageView</code>继承了<code>ViewFactory</code>，并重写了<code>showNext()</code>、<code>showPrevious()</code>方法，相比于<code>ViewSwitcher</code>使用更加简单。使用<code>ImageView</code>只需要以下两个步骤：</p> <ol><li>为<code>ImageView</code>提供一个<code>ViewFactory</code>且生成的<code>View</code>必须是<code>ImageView</code>；</li> <li>切换图片时调用<code>ImageView</code>的<code>setImageDrawable(Drawable drawable)</code>、<code>setImageResource(int resId)</code>和<code>setImageURI(Uri uri)</code>方法更换图片。</li></ol> <h3 id="viewflipper"><a href="#viewflipper" class="header-anchor">#</a> ViewFlipper</h3> <p><code>ViewFlipper</code>组件继承了<code>ViewAnimator</code>，可调用<code>addView(View view)</code>添加多个组件。<code>ViewFlipper</code>与<code>AdapterViewFlipper</code>有较大的相似性，区别在于<code>ViewFlipper</code>需要通过<code>addView(View view)</code>添加多个<code>View</code>，而<code>AdapterView</code>则只需要传入一个<code>Adapter</code>。</p> <h2 id="杂项组件"><a href="#杂项组件" class="header-anchor">#</a> 杂项组件</h2> <h3 id="toast"><a href="#toast" class="header-anchor">#</a> Toast</h3> <p><code>Toast</code>是非常方便的提示消息框，使用步骤：</p> <ol><li>调用<code>Toast</code>构造器或<code>makeText()</code>静态方法创建<code>Toast</code>对象；</li> <li>调用<code>Toast</code>方法来设置消息对其方式、页边距；</li> <li>调用<code>Toast</code>的<code>show()</code>方法将其显示出来。</li></ol> <h3 id="calendarview"><a href="#calendarview" class="header-anchor">#</a> CalendarView</h3> <table><thead><tr><th>xml属性</th> <th>相关方法</th> <th>说明</th></tr></thead> <tbody><tr><td>android:dateTextAppearance</td> <td>setDateTextAppearance(int)</td> <td>设置该日历视图的日期文字的样式</td></tr> <tr><td>android:firstDayOfWeek</td> <td>setFirstDayOfWeek(int)</td> <td>设置每周第一天，允许设置周一到周日任意一天作为每周第一天</td></tr> <tr><td>android:focusedMonthDateColor</td> <td>setFocusedMonthDateColor(int)</td> <td>设置获得焦点的月份的日期文字的颜色</td></tr> <tr><td>android:unfocusedMonthDateColor</td> <td>setUnFocusedMonthDateColor(int)</td> <td>设置未获得焦点的月份的日期文字的颜色</td></tr> <tr><td>android:maxDate</td> <td>setMaxDate(long)</td> <td>设置该日历组件支持的最大日期，以<code>mm/dd/yy</code>格式指定最大日期</td></tr> <tr><td>android:minDate</td> <td>setMinDate(long)</td> <td>设置该日历组件支持的最小日期，以<code>mm/dd/yy</code>格式指定最小日期</td></tr> <tr><td>android:selectedWeekBackgroundColor</td> <td>setWeekBackgroundColor(int)</td> <td>设置被选中的背景颜色</td></tr> <tr><td>android:showWeekNumber</td> <td>setShowWeekNumber(boolean)</td> <td>设置是否显示第几周</td></tr> <tr><td>android:weekDayTextAppearance</td> <td>setWeekDayTextAppearance(int)</td> <td>设置星期几的文字样式</td></tr> <tr><td>android:weekNumberColor</td> <td>setWeekNumberColor(int)</td> <td>设置周编号的颜色</td></tr> <tr><td>android:weekSeparatorLineColor</td> <td>setWeekSeparatorLineColor(int)</td> <td>设置周分割线的颜色</td></tr></tbody></table> <p>通过调用该组件的<code>setOnDateChangeListener()</code>方法来添加事件监听器。</p> <h3 id="datepicker和timerpicker"><a href="#datepicker和timerpicker" class="header-anchor">#</a> DatePicker和TimerPicker</h3> <table><thead><tr><th>xml属性</th> <th>相关方法</th> <th>说明</th></tr></thead> <tbody><tr><td>android:calendarTextColor</td> <td></td> <td>设置日历列表的文本颜色</td></tr> <tr><td>android:calendarViewShown</td> <td></td> <td>设置日历选择器是否显示<code>CalendarView</code>组件</td></tr> <tr><td>android:datePickerMode</td> <td></td> <td>设置日期选择模式，该属性支持<code>CalendarView</code>和<code>Spinner</code>两种模式</td></tr> <tr><td>android:dateOfWeekBackground</td> <td></td> <td>设置该日历视图的每周上方的页眉的颜色</td></tr> <tr><td>android:dateOfWeekTextAppearance</td> <td></td> <td>设置该日历视图的每周上方的页眉的文本外观</td></tr> <tr><td>android:startYear</td> <td></td> <td>设置该日历视图允许选择的第一年</td></tr> <tr><td>android:endYear</td> <td></td> <td>设置该日历视图允许选择的最后一年</td></tr> <tr><td>android:firstDayOfWeek</td> <td>setFirstDayOfWeek(int)</td> <td>设置每周第一天，允许设置周一到周日任意一天作为每周第一天</td></tr> <tr><td>android:headerBackground</td> <td></td> <td>设置选中日期的背景色</td></tr> <tr><td>android:headerDayOfMonthTextAppearance</td> <td></td> <td>设置选中日期中代表日的背景色</td></tr> <tr><td>android:headerMonthTextAppearance</td> <td></td> <td>设置选中日期中代表月的背景色</td></tr> <tr><td>android:headerYearTextAppearance</td> <td></td> <td>设置选中日期中代表年的背景色</td></tr> <tr><td>android:maxDate</td> <td></td> <td>设置该日历组件支持的最大日期，以<code>mm/dd/yy</code>格式指定最大日期</td></tr> <tr><td>android:minDate</td> <td></td> <td>设置该日历组件支持的最小日期，以<code>mm/dd/yy</code>格式指定最小日期</td></tr> <tr><td>android:spinnerShown</td> <td></td> <td>设置该日期选择器是否显示<code>Spinner</code>日期选择组件</td></tr></tbody></table> <p>通过调用该组件的<code>setOnDateChangeListener()</code>方法来添加事件监听器。</p> <h3 id="numberpicker"><a href="#numberpicker" class="header-anchor">#</a> NumberPicker</h3> <p>数值选择器用于让用户输入，用户可以通过键盘输入数值，也可通过拖动来选择数值。该组件有常用的以下方法：</p> <div class="language-java line-numbers-mode"><pre class="language-java"><code><span class="token comment">//设置组件支持的最小值</span>
<span class="token function">setMinValue</span><span class="token punctuation">(</span><span class="token keyword">int</span> vlaue<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">//设置组件支持的最大值</span>
<span class="token function">setMaxValue</span><span class="token punctuation">(</span><span class="token keyword">int</span> value<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">//设置组件支持的当前值</span>
<span class="token function">setValue</span><span class="token punctuation">(</span><span class="token keyword">int</span> value<span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br></div></div><p>通过调用该组件的<code>setOnValueChangeListener()</code>方法来添加事件监听器。</p> <h2 id="对话框"><a href="#对话框" class="header-anchor">#</a> 对话框</h2> <h3 id="alertdialog"><a href="#alertdialog" class="header-anchor">#</a> AlertDialog</h3> <p><code>AlertDialog</code>支持四个区域：图标区、标题区、内容区、按钮区</p> <p>创建一个对话框步骤：</p> <ol><li>创建 <code>AlertDialog.Builder</code>对象；</li> <li>调用 <code>AlertDialog.Builder</code>对象的<code>setTitle()</code>或<code>setCustomtitle()</code>方法设置标题；</li> <li>调用 <code>AlertDialog.Builder</code>对象的<code>setIcon()</code>方法设置图标；</li> <li>调用 <code>AlertDialog.Builder</code>对象的相关方法设置对话框内容；</li> <li>调用 <code>AlertDialog.Builder</code>对象的<code>setPositiveButton()</code>、<code>setNegativeButton()</code>、<code>setNeutralButton()</code>方法添加多个按钮；</li> <li>调用 <code>AlertDialog.Builder</code>对象的<code>create()</code>方法创建<code>AlertDialog</code>对象，再调用<code>AlertDialog</code>对象的<code>show()</code>方法显示该对话框。</li></ol> <p><code>AlertDialog</code>提供了以下6种方法来显示指定对话框内容：</p> <div class="language-java line-numbers-mode"><pre class="language-java"><code><span class="token comment">//显示简单文本</span>
<span class="token function">setMessage</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">//显示简单列表</span>
<span class="token function">setItems</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">//显示单选列表项</span>
<span class="token function">setSingleChoiceItems</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">//显示多选列表项</span>
<span class="token function">setMutilsChoiceItems</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">//显示自定义列表项</span>
<span class="token function">setAdapter</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">//显示自定义View</span>
<span class="token function">setView</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br></div></div><h3 id="popupwindow"><a href="#popupwindow" class="header-anchor">#</a> PopupWindow</h3> <p>使用步骤：</p> <ol><li>调用 <code>PopupWindow</code> 的构造器创建 <code>PopupWindow</code>;</li> <li>调用<code>PopupWindow</code>的<code>showAsDropDown(View viw)</code>以下拉组件方式显示或调用<code>showAtLocation()</code>方法在特定位置显示。</li></ol> <h3 id="datepickerdialog和timepickerdialog"><a href="#datepickerdialog和timepickerdialog" class="header-anchor">#</a> DatePickerDialog和TimePickerDialog</h3> <p>设置监听器核心代码：</p> <div class="language-java line-numbers-mode"><pre class="language-java"><code><span class="token class-name">Calendar</span> calendar <span class="token operator">=</span> <span class="token class-name">Calendar</span><span class="token punctuation">.</span><span class="token function">getInstance</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
                <span class="token keyword">new</span> <span class="token class-name">DatePickerDialog</span><span class="token punctuation">(</span><span class="token keyword">this</span><span class="token punctuation">,</span><span class="token punctuation">(</span>dp<span class="token punctuation">,</span>year<span class="token punctuation">,</span>month<span class="token punctuation">,</span>dayOfMonth<span class="token punctuation">)</span><span class="token operator">-&gt;</span><span class="token punctuation">{</span>
                    birthEd<span class="token punctuation">.</span><span class="token function">setText</span><span class="token punctuation">(</span>year<span class="token operator">+</span><span class="token string">&quot;年&quot;</span><span class="token operator">+</span>month<span class="token operator">+</span><span class="token string">&quot;月&quot;</span><span class="token operator">+</span>dayOfMonth<span class="token operator">+</span><span class="token string">&quot;日&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
                    <span class="token punctuation">}</span><span class="token punctuation">,</span>calendar<span class="token punctuation">.</span><span class="token function">get</span><span class="token punctuation">(</span><span class="token class-name">Calendar</span><span class="token punctuation">.</span><span class="token constant">YEAR</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
                    calendar<span class="token punctuation">.</span><span class="token function">get</span><span class="token punctuation">(</span><span class="token class-name">Calendar</span><span class="token punctuation">.</span><span class="token constant">MONTH</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
                    calendar<span class="token punctuation">.</span><span class="token function">get</span><span class="token punctuation">(</span><span class="token class-name">Calendar</span><span class="token punctuation">.</span><span class="token constant">DAY_OF_MONTH</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">show</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br></div></div><h3 id="progressdialog"><a href="#progressdialog" class="header-anchor">#</a> ProgressDialog</h3> <div class="language-java line-numbers-mode"><pre class="language-java"><code><span class="token comment">//进度条不显示进度值</span>
<span class="token function">setIndeterminater</span><span class="token punctuation">(</span><span class="token keyword">boolean</span> indeterminate<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">//设置进度条最大值</span>
<span class="token function">setMax</span><span class="token punctuation">(</span><span class="token keyword">int</span> max<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">//设置显示消息</span>
<span class="token function">setMessage</span><span class="token punctuation">(</span><span class="token class-name">CharSequence</span> message<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">//设置进度条的进度值</span>
<span class="token function">setProgress</span><span class="token punctuation">(</span><span class="token keyword">int</span> value<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">//设置进度条风格</span>
<span class="token function">setProgressStyle</span><span class="token punctuation">(</span><span class="token keyword">int</span> style<span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br></div></div><h2 id="菜单"><a href="#菜单" class="header-anchor">#</a> 菜单</h2> <h3 id="菜单和submenu"><a href="#菜单和submenu" class="header-anchor">#</a> 菜单和SubMenu</h3> <p><code>Android</code>的菜单具有以下特征：</p> <ol><li>选项菜单(Option Menu)：选项菜单不支持勾选标记，只显示菜单标题；</li> <li>子菜单（SubMenu)：不支持菜单图标，不支持嵌套子菜单；</li> <li>上下文菜单（ContextMenu)：不支持菜单快捷键和图标。</li></ol> <p><code>Menu</code>接口下包括两个子接口：<code>SubMenu</code>、<code>ContextMenu</code>，通过重载方法<code>add()</code>方法添加菜单项，<code>addSubMenu()</code>方法添加子菜单。</p> <p>使用步骤：</p> <ol><li>重写<code>Activity</code>的<code>onCreateOptionMenu(Menu menu)</code>方法，调用<code>Menu</code>对象的方法来添加菜单项和子菜单；</li> <li>重写<code>Activity</code>的<code>onOptionsItemSelected(MenuItem menuItem)</code>方法响应菜单项的单击事件。</li></ol> <p><code>Android</code>提供了使用<code>Java</code>代码和<code>XML</code>两种方式创建菜单，推荐使用<code>XML</code>方式创建菜单，菜单资源文件通常放到<code>\res\menu</code>目录下。</p> <div class="language-xml line-numbers-mode"><pre class="language-xml"><code><span class="token prolog">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;</span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>menu</span> <span class="token attr-name"><span class="token namespace">xmlns:</span>android</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>http://schemas.android.com/apk/res/android<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
	<span class="token comment">&lt;!-- 定义一组单选菜单项 --&gt;</span>
	<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>group</span> <span class="token attr-name"><span class="token namespace">android:</span>checkableBehavior</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>single<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
		<span class="token comment">&lt;!-- 定义三个菜单项 --&gt;</span>
		<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>item</span>
			<span class="token attr-name"><span class="token namespace">android:</span>id</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>@+id/red<span class="token punctuation">&quot;</span></span>
			<span class="token attr-name"><span class="token namespace">android:</span>title</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>@string/red_title<span class="token punctuation">&quot;</span></span>
			<span class="token attr-name"><span class="token namespace">android:</span>alphabeticShortcut</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>r<span class="token punctuation">&quot;</span></span><span class="token punctuation">/&gt;</span></span>
		<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>item</span>
			<span class="token attr-name"><span class="token namespace">android:</span>id</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>@+id/green<span class="token punctuation">&quot;</span></span>
			<span class="token attr-name"><span class="token namespace">android:</span>title</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>@string/green_title<span class="token punctuation">&quot;</span></span>
			<span class="token attr-name"><span class="token namespace">android:</span>alphabeticShortcut</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>g<span class="token punctuation">&quot;</span></span><span class="token punctuation">/&gt;</span></span>
		<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>item</span>
			<span class="token attr-name"><span class="token namespace">android:</span>id</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>@+id/blue<span class="token punctuation">&quot;</span></span>
			<span class="token attr-name"><span class="token namespace">android:</span>title</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>@string/blue_title<span class="token punctuation">&quot;</span></span>
			<span class="token attr-name"><span class="token namespace">android:</span>alphabeticShortcut</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>b<span class="token punctuation">&quot;</span></span><span class="token punctuation">/&gt;</span></span>
	<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>group</span><span class="token punctuation">&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>menu</span><span class="token punctuation">&gt;</span></span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br></div></div><p><code>MenuItem</code>的常用方法：</p> <div class="language-java line-numbers-mode"><pre class="language-java"><code><span class="token comment">//设置菜单项是否被勾选</span>
<span class="token function">setCheckable</span><span class="token punctuation">(</span><span class="token keyword">boolean</span> checkbale<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">//设置group里的所有菜单项是否可被勾选，若exclusive为true，表示它们是一组单选菜单项</span>
<span class="token function">setGroupCheckable</span><span class="token punctuation">(</span><span class="token keyword">int</span> group<span class="token punctuation">,</span><span class="token keyword">boolean</span> checkable<span class="token punctuation">,</span><span class="token keyword">boolean</span> exclusive<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">//设置字母快捷键</span>
<span class="token function">setAlphabeticShortCut</span><span class="token punctuation">(</span><span class="token keyword">char</span> alphaChar<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">//设置数字快捷键</span>
<span class="token function">setNumbericShortcut</span><span class="token punctuation">(</span><span class="token keyword">char</span> numericChar<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">//同时设置两种快捷键</span>
<span class="token function">setShortcut</span><span class="token punctuation">(</span><span class="token keyword">char</span> numericChar<span class="token punctuation">,</span><span class="token keyword">char</span> alphaChar<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">//关联Activity</span>
<span class="token function">setIntent</span><span class="token punctuation">(</span><span class="token class-name">Intent</span> itent<span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br></div></div><h3 id="contextmenu"><a href="#contextmenu" class="header-anchor">#</a> ContextMenu</h3> <p>使用步骤：</p> <ol><li>重写<code>Activity</code>的<code>onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo)</code>方法，调用<code>Menu</code>对象的方法来添加菜单项和子菜单；</li> <li>调用<code>Activity</code>的<code>registerForContextMenu(View viw)</code>方法为<code>View</code>组件注册上下文菜单；</li> <li>重写<code>Activity</code>的<code>onContextItemSelected(MenuItem menuItem)</code>方法响应菜单项的单击事件。</li></ol> <h3 id="popupmenu"><a href="#popupmenu" class="header-anchor">#</a> PopupMenu</h3> <p>创建弹出式菜的步骤：</p> <ol><li>调用<code>PopupMenu(Context context,View anchor)</code>构造器创建下拉菜单，<code>anchor</code>代表要激发该弹出菜单的组件；；</li> <li>调用<code>MenuInflater</code>的<code>inflate()</code>方法将菜单资源填充到<code>PopupMenu</code>中</li> <li>调用<code>PopuMenu</code>的show()`方法显示弹出式菜单。</li></ol> <h2 id="actionbar"><a href="#actionbar" class="header-anchor">#</a> ActionBar</h2> <p><code>ActionBar</code>提供了以下功能：</p> <ol><li>显示选项菜单</li> <li>使用程序图标作为返回<code>Home</code>主屏或显示成<code>Action Item</code></li> <li>提供交互式<code>View</code>作为<code>Action View</code></li> <li>提供基于<code>Tab</code>的导航方式，可用于切换多个<code>Fragment</code></li> <li>提供基于下拉方式的导航方式</li></ol> <h3 id="使用"><a href="#使用" class="header-anchor">#</a> 使用</h3> <p><code>Android3.0</code>版本默认启动了<code>ActionBar</code>，如果希望关闭，则可设置该应用的主题为<code>Xxx.NoactionBar</code>。</p> <div class="language-xml line-numbers-mode"><pre class="language-xml"><code><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>appliction</span>
            <span class="token attr-name"><span class="token namespace">android:</span>theme</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>@android:style/Theme.Material.NoActionBar<span class="token punctuation">&quot;</span></span>
            <span class="token attr-name"><span class="token namespace">android:</span>label</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>@String/app_name<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>appliction</span><span class="token punctuation">&gt;</span></span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br></div></div><p>可通过代码方式控制<code>ActionBar</code>的显示</p> <div class="language- line-numbers-mode"><pre class="language-text"><code>//显示ActionBar
show();
//隐藏ActionBar
hide();
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br></div></div><p><code>ActionBar</code>可以将菜单显示成<code>Action Item</code>，通过<code>setShowAsAction(int actionEnum)</code>，该方法设置是否将菜单项显示在<code>ActionBar</code>上，作为<code>Action Item</code>。</p> <p>方法支持以下参数：</p> <table><thead><tr><th>参数</th> <th>说明</th></tr></thead> <tbody><tr><td>SHOW_AS_ACTION_ALWAYS</td> <td>总是显示</td></tr> <tr><td>SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW</td> <td>折叠成普通菜单项</td></tr> <tr><td>SHOW_AS_ACTION_IF_ROOM</td> <td>有足够位置时才显示<code>MenuItem</code></td></tr> <tr><td>SHOW_AS_ACTION_NEVER</td> <td>不显示在<code>ActionBar</code>上</td></tr> <tr><td>SHOW_AS_ACTION_WITH_TEXT</td> <td>显示菜单项文本</td></tr></tbody></table> <p>在<code>XML</code>资源文件定义菜单：</p> <div class="language-xml line-numbers-mode"><pre class="language-xml"><code><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>item</span>
    <span class="token attr-name"><span class="token namespace">android:</span>showAsAction</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>always|withText<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>menu</span><span class="token punctuation">&gt;</span></span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>menu</span><span class="token punctuation">&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>item</span><span class="token punctuation">&gt;</span></span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br></div></div></div></section> <footer class="page-edit"><!----> <div class="last-updated"><span class="prefix">最近更新时间: </span> <span class="time">8/19/2022, 10:57:55 PM</span></div></footer> <div class="page-nav"><p class="inner"><span class="prev"><a href="/docs/android-notes/02-four-contents.html" class="prev">
          Android四大组件
        </a></span> <span class="next"><a href="/docs/android-notes/04-fragment-.html">
          Fragment
        </a></span></p></div> <div class="comments-wrapper"><!----></div></main></div> <!----></div> <ul class="sub-sidebar sub-sidebar-wrapper" style="width:12rem;" data-v-6986a797 data-v-6f8f7dda><li class="level-2" data-v-6986a797><a href="/docs/android-notes/03-android-ui.html#布局管理器" class="sidebar-link reco-side-布局管理器" data-v-6986a797>布局管理器</a></li><li class="level-3" data-v-6986a797><a href="/docs/android-notes/03-android-ui.html#linearlayout" class="sidebar-link reco-side-linearlayout" data-v-6986a797>LinearLayout</a></li><li class="level-3" data-v-6986a797><a href="/docs/android-notes/03-android-ui.html#tablelayout" class="sidebar-link reco-side-tablelayout" data-v-6986a797>TableLayout</a></li><li class="level-3" data-v-6986a797><a href="/docs/android-notes/03-android-ui.html#framelayout" class="sidebar-link reco-side-framelayout" data-v-6986a797>FrameLayout</a></li><li class="level-3" data-v-6986a797><a href="/docs/android-notes/03-android-ui.html#constrainlayout" class="sidebar-link reco-side-constrainlayout" data-v-6986a797>ConstrainLayout</a></li><li class="level-2" data-v-6986a797><a href="/docs/android-notes/03-android-ui.html#textview及其子类" class="sidebar-link reco-side-textview及其子类" data-v-6986a797>TextView及其子类</a></li><li class="level-3" data-v-6986a797><a href="/docs/android-notes/03-android-ui.html#textview" class="sidebar-link reco-side-textview" data-v-6986a797>TextView</a></li><li class="level-3" data-v-6986a797><a href="/docs/android-notes/03-android-ui.html#edittext" class="sidebar-link reco-side-edittext" data-v-6986a797>EditText</a></li><li class="level-3" data-v-6986a797><a href="/docs/android-notes/03-android-ui.html#button" class="sidebar-link reco-side-button" data-v-6986a797>Button</a></li><li class="level-3" data-v-6986a797><a href="/docs/android-notes/03-android-ui.html#radiobutton和checkbox" class="sidebar-link reco-side-radiobutton和checkbox" data-v-6986a797>RadioButton和CheckBox</a></li><li class="level-3" data-v-6986a797><a href="/docs/android-notes/03-android-ui.html#togglebutton和switch" class="sidebar-link reco-side-togglebutton和switch" data-v-6986a797>ToggleButton和Switch</a></li><li class="level-3" data-v-6986a797><a href="/docs/android-notes/03-android-ui.html#analogclock和textclock" class="sidebar-link reco-side-analogclock和textclock" data-v-6986a797>AnalogClock和TextClock</a></li><li class="level-3" data-v-6986a797><a href="/docs/android-notes/03-android-ui.html#chronometer" class="sidebar-link reco-side-chronometer" data-v-6986a797>Chronometer</a></li><li class="level-2" data-v-6986a797><a href="/docs/android-notes/03-android-ui.html#imageview及其子类" class="sidebar-link reco-side-imageview及其子类" data-v-6986a797>ImageView及其子类</a></li><li class="level-3" data-v-6986a797><a href="/docs/android-notes/03-android-ui.html#imageview" class="sidebar-link reco-side-imageview" data-v-6986a797>ImageView</a></li><li class="level-3" data-v-6986a797><a href="/docs/android-notes/03-android-ui.html#floatingactionbutton" class="sidebar-link reco-side-floatingactionbutton" data-v-6986a797>FloatingActionButton</a></li><li class="level-3" data-v-6986a797><a href="/docs/android-notes/03-android-ui.html#imageview-2" class="sidebar-link reco-side-imageview-2" data-v-6986a797>ImageView</a></li><li class="level-2" data-v-6986a797><a href="/docs/android-notes/03-android-ui.html#adapterview及其子类" class="sidebar-link reco-side-adapterview及其子类" data-v-6986a797>AdapterView及其子类</a></li><li class="level-3" data-v-6986a797><a href="/docs/android-notes/03-android-ui.html#adapter接口及其实现类" class="sidebar-link reco-side-adapter接口及其实现类" data-v-6986a797>Adapter接口及其实现类</a></li><li class="level-3" data-v-6986a797><a href="/docs/android-notes/03-android-ui.html#autocompletetextview" class="sidebar-link reco-side-autocompletetextview" data-v-6986a797>AutoCompleteTextView</a></li><li class="level-3" data-v-6986a797><a href="/docs/android-notes/03-android-ui.html#expandablelistview" class="sidebar-link reco-side-expandablelistview" data-v-6986a797>ExpandableListView</a></li><li class="level-3" data-v-6986a797><a href="/docs/android-notes/03-android-ui.html#adapterviewflipper" class="sidebar-link reco-side-adapterviewflipper" data-v-6986a797>AdapterViewFlipper</a></li><li class="level-3" data-v-6986a797><a href="/docs/android-notes/03-android-ui.html#stackview" class="sidebar-link reco-side-stackview" data-v-6986a797>StackView</a></li><li class="level-3" data-v-6986a797><a href="/docs/android-notes/03-android-ui.html#recyclerview" class="sidebar-link reco-side-recyclerview" data-v-6986a797>RecyclerView</a></li><li class="level-2" data-v-6986a797><a href="/docs/android-notes/03-android-ui.html#progressbar及其子类" class="sidebar-link reco-side-progressbar及其子类" data-v-6986a797>ProgressBar及其子类</a></li><li class="level-3" data-v-6986a797><a href="/docs/android-notes/03-android-ui.html#progressbar" class="sidebar-link reco-side-progressbar" data-v-6986a797>ProgressBar</a></li><li class="level-3" data-v-6986a797><a href="/docs/android-notes/03-android-ui.html#seekbar" class="sidebar-link reco-side-seekbar" data-v-6986a797>SeekBar</a></li><li class="level-3" data-v-6986a797><a href="/docs/android-notes/03-android-ui.html#ratingbar" class="sidebar-link reco-side-ratingbar" data-v-6986a797>RatingBar</a></li><li class="level-2" data-v-6986a797><a href="/docs/android-notes/03-android-ui.html#viewanimator及其子类" class="sidebar-link reco-side-viewanimator及其子类" data-v-6986a797>ViewAnimator及其子类</a></li><li class="level-3" data-v-6986a797><a href="/docs/android-notes/03-android-ui.html#viewswitcher" class="sidebar-link reco-side-viewswitcher" data-v-6986a797>ViewSwitcher</a></li><li class="level-3" data-v-6986a797><a href="/docs/android-notes/03-android-ui.html#imageswithcer" class="sidebar-link reco-side-imageswithcer" data-v-6986a797>ImageSwithcer</a></li><li class="level-3" data-v-6986a797><a href="/docs/android-notes/03-android-ui.html#viewflipper" class="sidebar-link reco-side-viewflipper" data-v-6986a797>ViewFlipper</a></li><li class="level-2" data-v-6986a797><a href="/docs/android-notes/03-android-ui.html#杂项组件" class="sidebar-link reco-side-杂项组件" data-v-6986a797>杂项组件</a></li><li class="level-3" data-v-6986a797><a href="/docs/android-notes/03-android-ui.html#toast" class="sidebar-link reco-side-toast" data-v-6986a797>Toast</a></li><li class="level-3" data-v-6986a797><a href="/docs/android-notes/03-android-ui.html#calendarview" class="sidebar-link reco-side-calendarview" data-v-6986a797>CalendarView</a></li><li class="level-3" data-v-6986a797><a href="/docs/android-notes/03-android-ui.html#datepicker和timerpicker" class="sidebar-link reco-side-datepicker和timerpicker" data-v-6986a797>DatePicker和TimerPicker</a></li><li class="level-3" data-v-6986a797><a href="/docs/android-notes/03-android-ui.html#numberpicker" class="sidebar-link reco-side-numberpicker" data-v-6986a797>NumberPicker</a></li><li class="level-2" data-v-6986a797><a href="/docs/android-notes/03-android-ui.html#对话框" class="sidebar-link reco-side-对话框" data-v-6986a797>对话框</a></li><li class="level-3" data-v-6986a797><a href="/docs/android-notes/03-android-ui.html#alertdialog" class="sidebar-link reco-side-alertdialog" data-v-6986a797>AlertDialog</a></li><li class="level-3" data-v-6986a797><a href="/docs/android-notes/03-android-ui.html#popupwindow" class="sidebar-link reco-side-popupwindow" data-v-6986a797>PopupWindow</a></li><li class="level-3" data-v-6986a797><a href="/docs/android-notes/03-android-ui.html#datepickerdialog和timepickerdialog" class="sidebar-link reco-side-datepickerdialog和timepickerdialog" data-v-6986a797>DatePickerDialog和TimePickerDialog</a></li><li class="level-3" data-v-6986a797><a href="/docs/android-notes/03-android-ui.html#progressdialog" class="sidebar-link reco-side-progressdialog" data-v-6986a797>ProgressDialog</a></li><li class="level-2" data-v-6986a797><a href="/docs/android-notes/03-android-ui.html#菜单" class="sidebar-link reco-side-菜单" data-v-6986a797>菜单</a></li><li class="level-3" data-v-6986a797><a href="/docs/android-notes/03-android-ui.html#菜单和submenu" class="sidebar-link reco-side-菜单和submenu" data-v-6986a797>菜单和SubMenu</a></li><li class="level-3" data-v-6986a797><a href="/docs/android-notes/03-android-ui.html#contextmenu" class="sidebar-link reco-side-contextmenu" data-v-6986a797>ContextMenu</a></li><li class="level-3" data-v-6986a797><a href="/docs/android-notes/03-android-ui.html#popupmenu" class="sidebar-link reco-side-popupmenu" data-v-6986a797>PopupMenu</a></li><li class="level-2" data-v-6986a797><a href="/docs/android-notes/03-android-ui.html#actionbar" class="sidebar-link reco-side-actionbar" data-v-6986a797>ActionBar</a></li><li class="level-3" data-v-6986a797><a href="/docs/android-notes/03-android-ui.html#使用" class="sidebar-link reco-side-使用" data-v-6986a797>使用</a></li></ul></div></div></div><div class="global-ui"><div class="back-to-ceiling" style="right:1rem;bottom:6rem;width:2.5rem;height:2.5rem;border-radius:.25rem;line-height:2.5rem;display:none;" data-v-c6073ba8 data-v-c6073ba8><svg t="1574745035067" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5404" class="icon" data-v-c6073ba8><path d="M526.60727968 10.90185116a27.675 27.675 0 0 0-29.21455937 0c-131.36607665 82.28402758-218.69155461 228.01873535-218.69155402 394.07834331a462.20625001 462.20625001 0 0 0 5.36959153 69.94390903c1.00431239 6.55289093-0.34802892 13.13561351-3.76865779 18.80351572-32.63518765 54.11355614-51.75690182 118.55860487-51.7569018 187.94566865a371.06718723 371.06718723 0 0 0 11.50484808 91.98906777c6.53300375 25.50556257 41.68394495 28.14064038 52.69160883 4.22606766 17.37162448-37.73630017 42.14135425-72.50938081 72.80769204-103.21549295 2.18761121 3.04276886 4.15646224 6.24463696 6.40373557 9.22774369a1871.4375 1871.4375 0 0 0 140.04691725 5.34970492 1866.36093723 1866.36093723 0 0 0 140.04691723-5.34970492c2.24727335-2.98310674 4.21612437-6.18497483 6.3937923-9.2178004 30.66633723 30.70611158 55.4360664 65.4791928 72.80769147 103.21549355 11.00766384 23.91457269 46.15860503 21.27949489 52.69160879-4.22606768a371.15156223 371.15156223 0 0 0 11.514792-91.99901164c0-69.36717486-19.13165746-133.82216804-51.75690182-187.92578088-3.42062944-5.66790279-4.76302748-12.26056868-3.76865837-18.80351632a462.20625001 462.20625001 0 0 0 5.36959269-69.943909c-0.00994388-166.08943902-87.32547796-311.81420293-218.6915546-394.09823051zM605.93803103 357.87693858a93.93749974 93.93749974 0 1 1-187.89594924 6.1e-7 93.93749974 93.93749974 0 0 1 187.89594924-6.1e-7z" p-id="5405" data-v-c6073ba8></path><path d="M429.50777625 765.63860547C429.50777625 803.39355007 466.44236686 1000.39046097 512.00932183 1000.39046097c45.56695499 0 82.4922232-197.00623328 82.5015456-234.7518555 0-37.75494459-36.9345906-68.35043303-82.4922232-68.34111062-45.57627738-0.00932239-82.52019037 30.59548842-82.51086798 68.34111062z" p-id="5406" data-v-c6073ba8></path></svg></div></div></div>
    <script src="/assets/js/app.371ed010.js" defer></script><script src="/assets/js/3.fe7e7b6d.js" defer></script><script src="/assets/js/1.adb5634c.js" defer></script><script src="/assets/js/33.52d0ee09.js" defer></script>
  </body>
</html>
